package org.papervision3d.materials.special;
import nme.display.Graphics;

import org.papervision3d.core.proto.MaterialObject3D;
import org.papervision3d.core.render.command.RenderLine;
import org.papervision3d.core.render.data.RenderSessionData;
import org.papervision3d.core.render.draw.ILineDrawer;

class LineMaterial extends MaterialObject3D, implements ILineDrawer
{
	
	public function new(color:Float = 0xFF0000, alpha:Float = 1)
	{
		super();
		this.lineColor = color;
		this.lineAlpha = alpha;
	}
	
	public function drawLine(line:RenderLine, graphics:Graphics, renderSessionData:RenderSessionData):Void
	{	
		graphics.lineStyle( line.size, lineColor, lineAlpha );
		graphics.moveTo( line.v0.x, line.v0.y );
		
		if(line.cV != null){
			graphics.curveTo(line.cV.x, line.cV.y, line.v1.x, line.v1.y);
		}else{
			graphics.lineTo( line.v1.x, line.v1.y );
		}
		
		graphics.moveTo(0,0);
		graphics.lineStyle();
	}
	
}
